home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  661 b   |  27 lines

  1. /* stat.c, from page 368 of Turbo C Bible */
  2. #include <stdio.h>
  3. #include <sys\types.h>
  4. #include <sys\stat.h>
  5. #include <time.h>
  6. main (int argc, char **argv)
  7. {
  8.    struct stat info;
  9.    if (argc < 2)
  10.    {
  11.         printf ("Usage: %s <pathname>\n", argv [0]);
  12.    }
  13.    else
  14.    {
  15.     if (stat (argv [1], &info) != 0)
  16.         {
  17.              perror ("Error in \"stat\"");
  18.              exit (1);
  19.         }
  20.                    /* Print out information about the file */
  21.     printf ("File: %s\n"
  22.                 "Drive        : %c\n"
  23.                 "Size         : %ld bytes, \n"
  24.             "Last modified: %s\n", argv [1], info.st_dev+65,
  25.                      info.st_size, ctime (&info.st_atime));
  26.    }
  27. }